<div class="modal" id="editModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				<h3 ng-hide='isNew'>Editar Produto: {{item.nome}}</h3>
				<h3 ng-show='isNew'>Incluir Produto</h3>
			</div>
			<form name="detailForm" ng-controller="DefaultFormCtrl" novalidate>
				<div class="modal-body">
					<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
					  	<li class="active"><a id="initTab" data-target="#aba1" data-toggle="tab">Produto</a></li>
					  	<li><a data-target="#aba2" data-toggle="tab">Estoque</a></li>
					</ul>
					<div id="my-tab-content" class="tab-content">
						<div class="tab-pane active" id="aba1">
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.referencia.$invalid && !detailForm.referencia.$pristine }">
										<label for="referencia">Refer&ecirc;ncia</label>
										<input type="text" class="form-control" id="referencia" name="referencia" maxlength="50" placeholder="Refer&ecirc;ncia" ng-model="item.referencia" required/>
										<span class="help-block" ng-show="detailForm.referencia.$invalid && !detailForm.referencia.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.descricao.$invalid && !detailForm.descricao.$pristine }">
										<label for="descricao">Descri&ccedil;&atilde;o</label>
										<input type="text" class="form-control" id="descricao" name="descricao" maxlength="100" placeholder="Descri&ccedil;&atilde;o" ng-model="item.descricao" required/>
										<span class="help-block" ng-show="detailForm.descricao.$invalid && !detailForm.descricao.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group">
										<label for="observacao">Observa&ccedil;&atilde;o</label>
										<input type="text" class="form-control" id="observacao" name="observacao" maxlength="100" placeholder="Observa&ccedil;&atilde;o" ng-model="item.observacao"/>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group">
										<label for="unidade">Unidade</label>
										<input type="text" class="form-control" id="unidade" name="unidade" maxlength="100" placeholder="Unidade" ng-model="item.unidade"/>
									</div>
								</div>
							</div>
							<div class="checkbox">
								<label for="cbxAtivo"><input type="checkbox" id="cbxAtivo" ng-model="item.ativo" ng-true-value="S" ng-false-value="N"> Ativo</label>
							</div>
						</div>
						<div class="tab-pane" id="aba2">
							<div class="form-group" ng-class="{ 'has-error' : detailForm.selForn.$invalid && !detailForm.selForn.$pristine }">
								<label for="selFunc">Fornecedores</label>
								<select class="form-control" id="selForn" name="selForn" ng-model="item.fornecedor.id" ng-options="f.id as f.empresa for f in fornecedores" required>
							    	<option value="">Selecione</option>
							  	</select>
							  	<span class="help-block" ng-show="detailForm.selForn.$invalid && !detailForm.selForn.$pristine">Campo obrigat&oacute;rio!</span>
							</div>
							<div class="form-group" ng-class="{ 'has-error' : detailForm.selLoja.$invalid && !detailForm.selLoja.$pristine }">
								<label for="selLoja">Loja</label>
								<select class="form-control" id="selLoja" name="selLoja" ng-model="item.loja.id" ng-options="l.id as l.nome for l in lojas" required>
							    	<option value="">Selecione</option>
							  	</select>
							  	<span class="help-block" ng-show="detailForm.selLoja.$invalid && !detailForm.selLoja.$pristine">Campo obrigat&oacute;rio!</span>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group">
										<label for="locEstoque">Local no estoque</label>
										<input type="text" class="form-control" id="locEstoque" name="locEstoque" maxlength="100" placeholder="Local no estoque" ng-model="item.localEstoque"/>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.quantidade.$invalid && !detailForm.quantidade.$pristine }">
										<label for="quantidade">Quantidade</label>
										<input type="text" class="form-control" id="quantidade" name="quantidade" maxlength="6" placeholder="Quantidade" ng-model="item.quantidade" required/>
										<span class="help-block" ng-show="detailForm.quantidade.$invalid && !detailForm.quantidade.$pristine">Campos obrigat&oacute;rios!</span>
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.preco1.$invalid && !detailForm.preco1.$pristine }">
										<label for="preco1">Pre&ccedil;o Custo (R$)</label>
										<input type="text" class="form-control moeda" id="preco1" name="preco1" maxlength="10" placeholder="Pre&ccedil;o Custo (R$)" ng-model="item.preco1" simon-decimal-format required/>
										<span class="help-block" ng-show="detailForm.preco1.$invalid && !detailForm.preco1.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.preco2.$invalid && !detailForm.preco2.$pristine }">
										<label for="preco2">Pre&ccedil;o Venda (R$)</label>
										<input type="text" class="form-control moeda" id="preco2" name="preco2" maxlength="10" placeholder="Pre&ccedil;o Venda (R$)" ng-model="item.preco2" simon-decimal-format required/>
										<span class="help-block" ng-show="detailForm.preco2.$invalid && !detailForm.preco2.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button class="btn btn-default" data-dismiss="modal" role="button">Fechar</button>
					<button ng-hide='isNew' class="btn btn-primary" id="btnAtualizar" data-dismiss="modal" ng-click="update()" role="button" ng-disabled="detailForm.$invalid">Atualizar</button>
					<button ng-show='isNew' class="btn btn-primary" id="btnIncluir" data-dismiss="modal" ng-click="insert()" role="button" ng-disabled="detailForm.$invalid">Incluir</button>
				</div>
			</form>
		</div>
	</div>
</div>